<?php

// $Id$

require_once(TANGRA_MAIN_DIR.'form/guardable_form.class.php');
require_once(TANGRA_MAIN_DIR.'form/fields/file/form_field_file.class.php');
require_once(TANGRA_MAIN_DIR.'/form/static_html_form_generator.class.php');


class Attachment_Upload_Form extends Guardable_Form {
	function __construct($max_size) {
		parent::__construct('attachment_upload', 'admin/modules/tangra_cms/attachment/attachment_upload.php');

		$f_attachment = new Form_Field_File('attachment', true, $max_size);
		$f_attachment->add_potential_error('invalid_extension');

		$this->add_field($f_attachment);
	}


	public function generate_html() {
		$html_gen = new Static_HTML_Form_Generator($this, 'modules/form_html_tpl_static_ajax_metallic_en', 'en');
		$html_gen->create_default_tpl_maps();
		$html_gen->change_field_p_error_map_entry('attachment', 'invalid_extension', 'modules/tangra_cms/forms/field_errors/attachment_upload/field_error_invalid_extension.tpl');
		printbr('<pre>');
		printbr(htmlentities($html_gen->get_static_html()));
		printbr('</pre>');
	}
}
